package com.morningstar.system.api.feign.fallback;

import com.morningstar.common.arco.SelectOption;
import com.morningstar.system.api.feign.ISystemFormFeign;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.exception.ExceptionUtils;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.List;

@Slf4j
@Component
public class SystemFormFeignFactory implements FallbackFactory<ISystemFormFeign> {
    @Override
    public ISystemFormFeign create(Throwable cause) {
        log.error("ISystemUserFeign {}", ExceptionUtils.getStackTrace(cause));
        return new SystemFormFeignFallback();
    }

    class SystemFormFeignFallback implements ISystemFormFeign {

        @Override
        public List<SelectOption> select() throws Exception {
            return new ArrayList<>();
        }
    }
}
